#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Paas.Svc.Host/Paas.Svc.Host.csproj", "Paas.Svc.Host/"]
COPY ["Paas.App/Paas.App.csproj", "Paas.App/"]
COPY ["Paas.Core/Paas.Core.csproj", "Paas.Core/"]
COPY ["Basefr.Core/Basefr.Core.csproj", "Basefr.Core/"]
COPY ["Basefr.Logging/Basefr.Logging.csproj", "Basefr.Logging/"]
COPY ["Basefr/Basefr.csproj", "Basefr/"]
COPY ["Basefr.Runtime/Basefr.Runtime.csproj", "Basefr.Runtime/"]
COPY ["Paas.Core.Const/Paas.Core.Const.csproj", "Paas.Core.Const/"]
COPY ["Basefr.Async/Basefr.Async.csproj", "Basefr.Async/"]
COPY ["Paas.Infrastructure.Data/Paas.Infrastructure.Data.csproj", "Paas.Infrastructure.Data/"]
COPY ["Basefr.Data/Basefr.Data.csproj", "Basefr.Data/"]
COPY ["Basefr.App/Basefr.App.csproj", "Basefr.App/"]
COPY ["Paas.App.Interface/Paas.App.Interface.csproj", "Paas.App.Interface/"]
COPY ["Basefr.Web/Basefr.Web.csproj", "Basefr.Web/"]
COPY ["Basefr.Auth/Basefr.Auth.csproj", "Basefr.Auth/"]
RUN dotnet restore "Paas.Svc.Host/Paas.Svc.Host.csproj"
COPY . .
WORKDIR "/src/Paas.Svc.Host"
RUN dotnet build "Paas.Svc.Host.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Paas.Svc.Host.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Paas.Svc.Host.dll"]